UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TKVlkiJMb3scSWhpKsSAKoB9spwmV9DHhB9UIDuu5Gg='
WHERE
key_id = 'dc4290176ca32f0f2dc9609623c2ec1be04514aeb30338c7f8299650f3b63947'
AND (
token = 'TKVlkiJMb3scSWhpKsSAKoB9spwmV9DHhB9UIDuu5Gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)