UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CqNvdnHjXCcMfY8/zu7PSca+CjsJvdm2KK1+Q06qSX8='
WHERE
key_id = '81b3ee0573dc88015a145c46fd05d847e794c232f35ebd6452cb35943a38a588'
AND (
token = 'CqNvdnHjXCcMfY8/zu7PSca+CjsJvdm2KK1+Q06qSX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)