UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EpQZib9Fm1D0B6We4s01C0Y7BFcGbYWZ5xk0sg3TOGU=' 
WHERE 
  key_id = '47f087d51637f6c6f2bf544039bc0ab61f57d7e1cb6440f3a14e3efcef4568b2' 
  AND (
    token = 'EpQZib9Fm1D0B6We4s01C0Y7BFcGbYWZ5xk0sg3TOGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032