UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YB33tCHIR93m37NNVDgcjhmYux45klQoUA7k4qmJtDs=' 
WHERE 
  key_id = '3861b4a677b93fb94093385962f6f15b6421df4225c99d2c1fad020e1d5dfbc1' 
  AND (
    token = 'YB33tCHIR93m37NNVDgcjhmYux45klQoUA7k4qmJtDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019