UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4sb7J+zRBhR084F65ZE0sPKJt/40gBvDf5sAKF2UcX8=' 
WHERE 
  key_id = '7a5d8293172f89a124e7c781ba7dfb2c6edc335103997ae4472467b8b4fb71ad' 
  AND (
    token = '4sb7J+zRBhR084F65ZE0sPKJt/40gBvDf5sAKF2UcX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041