UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z3a19vRjDEmUuhvT5po04vcFPqf/6oE4jwFoijO1AI0='
WHERE
key_id = '949b3eb4905c242c146c6c5c837d94b41544dfda387e928b5c8501f02d345a58'
AND (
token = 'Z3a19vRjDEmUuhvT5po04vcFPqf/6oE4jwFoijO1AI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)