UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BkMZHtqRW3qj5jHYChSOHiqcOK99hap2iOwDDI90Eu4='
WHERE
key_id = '71f5a99614c1e4e464fab1cc35239d8c42224428b0dd44770ddc1eabd8875c66'
AND (
token = 'BkMZHtqRW3qj5jHYChSOHiqcOK99hap2iOwDDI90Eu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)