UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lIY/WaVUb0J1NF02C/c4yMhZGx7NqGH4fBBGGPHc0ZY=' 
WHERE 
  key_id = 'b67249e3a7267d800cdfa82196ef2d8132f6eaa29f3f1ddcb294e23624ab6e9c' 
  AND (
    token = 'lIY/WaVUb0J1NF02C/c4yMhZGx7NqGH4fBBGGPHc0ZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033