UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SzP0idxV5ap1S7fayPEuUTklOEoEGdRbp2b1pTz65Q8='
WHERE
key_id = '661305c5e56d61a62beab02edfad3e66f4ede76bc9dbd5b9eba107655d9f41c4'
AND (
token = 'SzP0idxV5ap1S7fayPEuUTklOEoEGdRbp2b1pTz65Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)