UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bjxtNg+0RTsDXyrrS2KlmXzbnEqbobVBkyijlCSWaq4=' 
WHERE 
  key_id = '12c5289c2a2be18ae0bf3f28f06a6529e208df3a53a72bac28c7cdace04755c3' 
  AND (
    token = 'bjxtNg+0RTsDXyrrS2KlmXzbnEqbobVBkyijlCSWaq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036