UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K78Bp1QYg5V+0wj5Mya3lBEN2NwQMYkJlNUnvhtS/VQ=' 
WHERE 
  key_id = 'a1ed6e3f6fd370bc606d5aa6ea6f2bb4b6facb9fba575c946a807ea205d302c9' 
  AND (
    token = 'K78Bp1QYg5V+0wj5Mya3lBEN2NwQMYkJlNUnvhtS/VQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036