UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nTnx4E+iN84RBnW+tR6mst4P/qON1/+itCy+L5IOkrc='
WHERE
key_id = 'bc96684f6bf8cd54968f345f9246c77c332ac1b3eb7d5244bee55a8341ee8ad9'
AND (
token = 'nTnx4E+iN84RBnW+tR6mst4P/qON1/+itCy+L5IOkrc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)