UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y2IOHctaqIrWRk2RvJe+uyA8U5tLuEyq6L4JPvtSnM4='
WHERE
key_id = 'c823d4dfcac7e1a784eea65a301eac645095e3539cbcbb50ae14b1778551bb2f'
AND (
token = 'y2IOHctaqIrWRk2RvJe+uyA8U5tLuEyq6L4JPvtSnM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)