UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TDPVqT12C1gzAJw+fMeTPJjHmU3b2cuA4u4RJAGeSwE='
WHERE
key_id = '23d409e60805ebfee2607fc6c21e33456124c9cb0c39d36f05528f0e74d23e34'
AND (
token = 'TDPVqT12C1gzAJw+fMeTPJjHmU3b2cuA4u4RJAGeSwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)