UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/5euYySca8Gv/RywyWSxep8Df/3M3SCX7gUroderLU=' 
WHERE 
  key_id = '8bf8da58c7ccc310e243344a458c74b69eba534861dcf870f4c0e224a6a8f170' 
  AND (
    token = 'K/5euYySca8Gv/RywyWSxep8Df/3M3SCX7gUroderLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033