UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UjRz1qHSOU55dVcNyl/OxqD+ENTfVTwZanfA6s+wtyI='
WHERE
key_id = '78419c5834a68cf0e2855eb65f5606fb758b3ce640c60e4125a80d409ce0df7d'
AND (
token = 'UjRz1qHSOU55dVcNyl/OxqD+ENTfVTwZanfA6s+wtyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)