UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tc0IFnc8jzA7BOGzANN2tmktAM7tTmKNlS6nB2938As='
WHERE
key_id = '4f7a5a504ddec4e5c93ac5e568183e0d7983f9c6dc1b6e70b632cd6bb57df053'
AND (
token = 'tc0IFnc8jzA7BOGzANN2tmktAM7tTmKNlS6nB2938As='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)