UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJLiwvAtpgErS/OITKwzBcdITw0oPP2jgD5I3G8/els=' 
WHERE 
  key_id = 'eb629c7547bf4e428587a22383858329912eb8c789b929d4bc2dc5ee1f216c88' 
  AND (
    token = 'AJLiwvAtpgErS/OITKwzBcdITw0oPP2jgD5I3G8/els=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016