UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LRDxiZNBtGlFFJDvPZoAYoQ1QZBBo2Zg0tvJiSdnaUQ='
WHERE
key_id = '3e1b01006f44ad4cde30a7f4104dfabf511852e6d638592c2853b853012ef560'
AND (
token = 'LRDxiZNBtGlFFJDvPZoAYoQ1QZBBo2Zg0tvJiSdnaUQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)