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