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