UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '02irmsQ+xJ8CGLHQUXwaUkwrZd3bEugZtNgfxNy62FE='
WHERE
key_id = '2cc52815626517acb7f3d916517c08fc56938f1d5637daec2b03c6b2ff2f9304'
AND (
token = '02irmsQ+xJ8CGLHQUXwaUkwrZd3bEugZtNgfxNy62FE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)