UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PChXuepOjiq4Q8q0bSkauwWkHn00IgIgDClk3K3BH8='
WHERE
key_id = '8345a96d355153676078d13cc665d4ec8db8ddd8515032371f3907057f8aa6ab'
AND (
token = '6PChXuepOjiq4Q8q0bSkauwWkHn00IgIgDClk3K3BH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)