UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TzmwVZrQ5mgw7aXZH4IYG1lmDH9m9/+MLUVNaq2tnzo=' 
WHERE 
  key_id = '743beadf6c474f931d5af0a85d97afc7c32627bc3969ed032a491f8ebdffe07c' 
  AND (
    token = 'TzmwVZrQ5mgw7aXZH4IYG1lmDH9m9/+MLUVNaq2tnzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020