UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/p32LYUNi0yUmKZnMypNVkLO1XajK7m2x47201OyFmM='
WHERE
key_id = '09de6fe31096013f844b0637fbda6a181a8b35396e0c3a310ae2f6a4000d4291'
AND (
token = '/p32LYUNi0yUmKZnMypNVkLO1XajK7m2x47201OyFmM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)