UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k491emECrFMOF8uU48RC+kuJzV18r5uYk7x32iXYeU8='
WHERE
key_id = '94e8516a456ed4cbbc7d57e88ee2c3ca19a423f845229d3370c8550bab691827'
AND (
token = 'k491emECrFMOF8uU48RC+kuJzV18r5uYk7x32iXYeU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)