UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1mD5Ko22o6GGnc/6VGWy/HP0/ImCOJvq7burePZx7pA=' 
WHERE 
  key_id = '3d7ebc1c2be68fb74842c9e7c5e5839c36eb5cb399b0eb3abb2513d9081bd5b1' 
  AND (
    token = '1mD5Ko22o6GGnc/6VGWy/HP0/ImCOJvq7burePZx7pA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041