UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cf277Y3OnIY0LY8TP0PaQio+T+VYN/glHVZWtSAnxP0='
WHERE
key_id = '9f6536916890647d0d96b0ac9c6436046ec0fe8a670e6a587a21d688d7cb86f3'
AND (
token = 'Cf277Y3OnIY0LY8TP0PaQio+T+VYN/glHVZWtSAnxP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)