UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H3v5jqPFdOTjAptnWIAfgNTPtswdIEyV6naxJJGjsnY='
WHERE
key_id = '1fbb1014904047a470d2776b9bb3fb437d12b08526817022a0c1183a831f480e'
AND (
token = 'H3v5jqPFdOTjAptnWIAfgNTPtswdIEyV6naxJJGjsnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)