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