UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7DLgJIt12lyjE1YhbpYdCsqbaX2uEvM5XV285I48UCM='
WHERE
key_id = '862a0d8999f043942899be651718ceae123499e57ca682b0ce74ed7028fbacb1'
AND (
token = '7DLgJIt12lyjE1YhbpYdCsqbaX2uEvM5XV285I48UCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)