UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fm8ut4uRleNstvp2UfuOa2e8Drbdt/W/3AYvsuqB4ms=' 
WHERE 
  key_id = '4e3889bef9fe30f9b123e893bd6e1bac92a297f310210b6d093cdb20e6e8e1b1' 
  AND (
    token = 'Fm8ut4uRleNstvp2UfuOa2e8Drbdt/W/3AYvsuqB4ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021