UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrKm0WNw8+68jkvexDCyKZfg9xTXFsj8h38ev/tC3uM='
WHERE
key_id = '0c649f06e94e8cfee5236453c16988c44acc5bb9aa066a44c645a088e7d40521'
AND (
token = 'KrKm0WNw8+68jkvexDCyKZfg9xTXFsj8h38ev/tC3uM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)