UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G5WoFgHbblbloRjVBylR3u3rBt1o1IgpNDe82t6Du2s='
WHERE
key_id = 'bd1f680cc122fa95d0a0588da3f87b7bd0f634546bb343f182a6d7f317cde3f5'
AND (
token = 'G5WoFgHbblbloRjVBylR3u3rBt1o1IgpNDe82t6Du2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)