UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y3MjmI+mq/amssjZmnoB2lLc4suqQ9tBoBV0RUsobpY=' 
WHERE 
  key_id = '1a6c01556a59b73c90573d5744357b59c2c7d19fdb35f6157ec5eed2f4717f99' 
  AND (
    token = 'y3MjmI+mq/amssjZmnoB2lLc4suqQ9tBoBV0RUsobpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037