UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ADQO5YAX2l/mTzcHyJ3M+ZG7gTT2AQ4rQERlgCVIc8E=' 
WHERE 
  key_id = '3865334f8b8323ca0758a03f598532dd9199c651b0b4d171908fcc89982c026d' 
  AND (
    token = 'ADQO5YAX2l/mTzcHyJ3M+ZG7gTT2AQ4rQERlgCVIc8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034