UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TimIHQrzy9CjO9lrBResG5f/U9dIzQCFQI6/KHB0lP8=' 
WHERE 
  key_id = 'a733e22817640c84f793d10d4712df8857a86153e2caddd52afef022ad6c2bd8' 
  AND (
    token = 'TimIHQrzy9CjO9lrBResG5f/U9dIzQCFQI6/KHB0lP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043