UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LKqzPz5y71B5V5dBlWCumvmJPDNxYhlaZE6pjjkILhE='
WHERE
key_id = '1de182d75a87e5e1706072c1535851edd5b7591cc92c76d80ab5dfa0676d17ce'
AND (
token = 'LKqzPz5y71B5V5dBlWCumvmJPDNxYhlaZE6pjjkILhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)