UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LLamYh1N88kc0p5pf3nKdN+GpDUNvT6W2WFozdRG27s='
WHERE
key_id = 'c6c0cb325f68c3339c027f637760b08cd8a7c52ab17876bd41597cb64298bdc9'
AND (
token = 'LLamYh1N88kc0p5pf3nKdN+GpDUNvT6W2WFozdRG27s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)