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