UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pk5vlrASsosKWzUW5yoZV5EKLuPCMZYqI+HtZbUgQvw=' 
WHERE 
  key_id = '3bf6981982449a98cc4bbb64c54a83fa2d4b3fecdd97e8fa6c9d17f34ad5df35' 
  AND (
    token = 'pk5vlrASsosKWzUW5yoZV5EKLuPCMZYqI+HtZbUgQvw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042