UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HNJXtyERzZJUcvWfWnxK9xhX0fv3a+Ry84GF5kgyzMo='
WHERE
key_id = '00f457c17f32b902e59138cb9ecd63fc5a931f82285d5ba535427ad32a486ef1'
AND (
token = 'HNJXtyERzZJUcvWfWnxK9xhX0fv3a+Ry84GF5kgyzMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)