UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kB6mjwNKNDbYHihk171fQUmdKYMrbbUok0mtmqvcgCU='
WHERE
key_id = '674ca4d9f05ab8919e856feeac6d655e03ba5695b7fa077df62be0c3a79e82f1'
AND (
token = 'kB6mjwNKNDbYHihk171fQUmdKYMrbbUok0mtmqvcgCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)