UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DbXcG+5BhZ8Ekg54OAfaOZnT9gQWG7kTRqb9Ya43yi8=' 
WHERE 
  key_id = 'ab6d9fd03036b2a485c2ca5789a9843d5ad6d1a4927aca090356b7bd527a3138' 
  AND (
    token = 'DbXcG+5BhZ8Ekg54OAfaOZnT9gQWG7kTRqb9Ya43yi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025