UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ecKRc3kPqOnEQ3vVnSU5d5/tqRivZMHU3szklqcFwMk='
WHERE
key_id = '76d7f4e5f6031b9d3f3e70e289a3287a4cfbb720142c0ed453dda4ecca3f7894'
AND (
token = 'ecKRc3kPqOnEQ3vVnSU5d5/tqRivZMHU3szklqcFwMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)