UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iXPRvfS+CORtTdBqGVZw6yybstdQvCSmKNOQA1PoxIY=' 
WHERE 
  key_id = '243e3c8c2c2ffa840b71b11c6c87b0a1cb6c6cd6252e4ea85fdc5af927ba3735' 
  AND (
    token = 'iXPRvfS+CORtTdBqGVZw6yybstdQvCSmKNOQA1PoxIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028