UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cyHTO6nTKPpcoDKVB4k9EZAqlLm7/lPV+S1fJrH+MEs=' 
WHERE 
  key_id = '1d43c0b16d258c4ed72dde3c357e0b7509f23157d1a9507a8108ee36d75591d7' 
  AND (
    token = 'cyHTO6nTKPpcoDKVB4k9EZAqlLm7/lPV+S1fJrH+MEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022