UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QxwJasvZmEZYLT6u6xfhGRvJLx9jygj5xnCH7V4uxyY='
WHERE
key_id = '538ecc7e0e3333ce974140a00797365757933b8c8852fb0c1e89f3bc731c0ad7'
AND (
token = 'QxwJasvZmEZYLT6u6xfhGRvJLx9jygj5xnCH7V4uxyY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)