UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+sUE1Fevkvq96tOS6BMmE+3q2oeQkbCfH0BATJ0DuM=' 
WHERE 
  key_id = '812c8a270024edc1c766cafcfeea243d15d6bb7a54eaf76a58788befea7df53f' 
  AND (
    token = 'L+sUE1Fevkvq96tOS6BMmE+3q2oeQkbCfH0BATJ0DuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030