UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r1mHLEEMv3zpdr419zRUmlUApM3clXvHljBivsjtbaA=' 
WHERE 
  key_id = '8bcc9edf34e8243089a53ef2fa587f5e18e3ee1c0e7795edbeaa734ec79b9526' 
  AND (
    token = 'r1mHLEEMv3zpdr419zRUmlUApM3clXvHljBivsjtbaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044