UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '56zWRH3Sl87CsncXPrO4vWbJ+McgYlUtcGsw6FYAg98=' 
WHERE 
  key_id = '09d7cc68d66aea8e21538e9de445f965c5ee49589fe2c7d2509ce2cc40d9cee4' 
  AND (
    token = '56zWRH3Sl87CsncXPrO4vWbJ+McgYlUtcGsw6FYAg98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037