UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'glAt3LfeseOVMnegOGVYUSpp0QK574rLeSYZyJuGgiE='
WHERE
key_id = '12d2d59cd7648d2c4a917e9fbb777fa9146603f601e10a17e4623dca98dfa658'
AND (
token = 'glAt3LfeseOVMnegOGVYUSpp0QK574rLeSYZyJuGgiE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)