UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UO4jjlCuNM+qTnpWyn5AV1jjvjOlnqEPP+xOvnp76Ek='
WHERE
key_id = '1c653c263f7ae06e91f36806b42145039a5e7614c68585d65e71f7f2464f6318'
AND (
token = 'UO4jjlCuNM+qTnpWyn5AV1jjvjOlnqEPP+xOvnp76Ek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)