UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MtW6ueAQjW3twxN+5it3sDtfWrLaEIpZa7rNO+uRCuI=' 
WHERE 
  key_id = '193656cc36e6346a75232c8c88c62608db2b99a5e658f402f431da830ab9f301' 
  AND (
    token = 'MtW6ueAQjW3twxN+5it3sDtfWrLaEIpZa7rNO+uRCuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034