UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O5MmmY1r34jJPUm4s3cHUnjkafQHWWBDEV9WFLEkWMc=' 
WHERE 
  key_id = 'c73c60bff281082d904ef5ad2bc9116926aa9820dcc062b75866a94b408dca98' 
  AND (
    token = 'O5MmmY1r34jJPUm4s3cHUnjkafQHWWBDEV9WFLEkWMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041