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