UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xtbH74EiBvhCC+YHFG5d5bwX0Gcbm8tBySEDfrS6VCQ='
WHERE
key_id = 'd56d3fa190999490e45580cd055633be8983ce6194e0da557c0575417dea3f36'
AND (
token = 'xtbH74EiBvhCC+YHFG5d5bwX0Gcbm8tBySEDfrS6VCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)