UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gCCuyKRzfFXvkQ+avTuiJ8sZJGenHFeXh7bSTzie1bg='
WHERE
key_id = '7dd2de0bf277b0672398399f4d70e9889170d1920e602d777dfe995db772a9f2'
AND (
token = 'gCCuyKRzfFXvkQ+avTuiJ8sZJGenHFeXh7bSTzie1bg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)