UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dCyh/VfYzE1vuPpWJSYRyqX/P4aqhARm++cBpUZvwhk=' 
WHERE 
  key_id = '938405e8d67172694d12e71b69a205df84c030bf65d8e6d1aa7445207b4e4a01' 
  AND (
    token = 'dCyh/VfYzE1vuPpWJSYRyqX/P4aqhARm++cBpUZvwhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052